package com.xyw.code.platform.webapps.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xyw.code.platform.common.entity.po.SysRoleMenu;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 角色菜单表 Mapper 接口
 * </p>
 *
 * @author xyw
 * @since 2020-02-07
 */
@Mapper
public interface SysRoleMenuMapper extends BaseMapper<SysRoleMenu> {

    /**
     * 根据userid获得菜单id
     * @param userId
     * @return
     */
    @Select("SELECT rm.menu_id FROM sys_role_menu rm, sys_user_role ur, sys_user u WHERE u.id = #{userId} AND u.id = ur.user_id AND rm.role_id = ur.role_id")
    List<String> getMenuIdByUserId(Long userId);
}
